package a1_p04_ak_fh_test;

import static org.junit.Assert.*;

import java.util.ArrayList;
import java.util.List;

import org.jgraph.graph.DefaultEdge;
import org.jgrapht.Graph;
import org.junit.Test;

import a1_p04_ak_fh.DepthFirstSearch;
import a1_p04_ak_fh.IOHelper;

public class DepthFirstSearchTest {
	
	List<String> g1 = new ArrayList<String>();
	List<String> g2 = new ArrayList<String>();
	List<String> g3 = new ArrayList<String>();

	@Test
	public void Grap1() {
		
		g1.add("a");
		g1.add("c");
		g1.add("d");
		g1.add("e");
		g1.add("f");
		
		IOHelper IOHelper = new IOHelper();

		Graph<String, DefaultEdge> graph = IOHelper
				.readGraphFile("graph1.gka");

		assertEquals(g1, DepthFirstSearch.DFS(graph, "a", "f"));
	}
	
	@Test
	public void Grap2() {
		
		g2.add("a");
		g2.add("c");
		g2.add("f");
		
		IOHelper IOHelper = new IOHelper();

		Graph<String, DefaultEdge> graph = IOHelper
				.readGraphFile("graph2.gka");

		assertEquals(g2, DepthFirstSearch.DFS(graph, "a", "f"));
	}
	
	
	@Test
	public void k5() {
		
		g3.add("a");
		g3.add("c");
		
		IOHelper IOHelper = new IOHelper();

		Graph<String, DefaultEdge> graph = IOHelper
				.readGraphFile("k5.gka");

		assertEquals(g3, DepthFirstSearch.DFS(graph, "a", "c"));
	}

}
